home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
dskut
/
patch12.zip
/
TCPATCH.DIF
< prev
next >
Wrap
Text File
|
1990-05-31
|
16KB
|
566 lines
*** ../patch/common.h Thu May 24 14:21:46 1990
--- common.h Thu May 31 10:28:21 1990
***************
*** 1,6 ****
! /* $Header: common.h,v 2.0.1.2 88/06/22 20:44:53 lwall Locked $
*
* $Log: common.h,v $
* Revision 2.0.1.2 88/06/22 20:44:53 lwall
* patch12: sprintf was declared wrong
*
--- 1,9 ----
! /* $Header: common.h,v 2.0.1.3 90/05/30 11:30:00 mward $
*
* $Log: common.h,v $
+ * Revision 2.0.1.3 90/05/30 11:30:00 mward
+ * added TURBOC stuff
+ *
* Revision 2.0.1.2 88/06/22 20:44:53 lwall
* patch12: sprintf was declared wrong
*
***************
*** 40,51 ****
--- 43,68 ----
#include <ctype.h>
#include <signal.h>
+ #ifdef TURBOC20
+ #include <stdlib.h>
+ #include <string.h>
+ #include <io.h>
+ #include <fcntl.h>
+ #endif
+
/* constants */
#define TRUE (1)
#define FALSE (0)
+ #ifdef TURBOC20
+ #define MAXPATH 80 /* max path spec size */
+ #define MAXMEMBLK 65534L /* biggest block of mem */
+ #define MAXHUNKSIZE (MAXMEMBLK/sizeof(char *)) /* is this enough lines? */
+ #else
#define MAXHUNKSIZE 100000 /* is this enough lines? */
+ #endif
+
#define INITHUNKMAX 125 /* initial dynamic allocation size */
#define MAXLINELEN 1024
#define BUFFERSIZE 1024
***************
*** 145,150 ****
--- 162,168 ----
EXT char *revision INIT(Nullch); /* prerequisite revision, if any */
+ #ifndef TURBOC20
char *malloc();
char *realloc();
char *strcpy();
***************
*** 156,159 ****
--- 174,178 ----
char *sprintf();
#else
int sprintf();
+ #endif
#endif
*** ../patch/config.h Thu May 24 14:21:52 1990
--- config.h Thu May 31 10:36:24 1990
***************
*** 1,25 ****
/* config.h
! * This file was produced by running the Configure script.
* Feel free to modify any of this as the need arises.
*/
! #/*undef EUNICE /* no file linking? */
! #/*undef VMS
! #/*undef index strchr /* cultural */
! #/*undef rindex strrchr /* differences? */
- #/*undef void int /* is void to be avoided? */
-
/* How many register declarations are paid attention to? */
#define Reg1 register
#define Reg2 register
#define Reg3 register
! #define Reg4 register
! #define Reg5 register
! #define Reg6 register
#define Reg7
#define Reg8
#define Reg9
--- 1,36 ----
+ /* $Header: cofig.h,v 2.0.1 90/05/30 11:30:00 mward $
+ *
+ * $Log: config.h,v $
+ * Revision 2.0.1 90/05/30 11:30:00 mward
+ * set up for MSDOS TURBOC v2.0
+ */
+
/* config.h
! * This file was produced by hand for MSDOS TURBOC V2.0.
* Feel free to modify any of this as the need arises.
*/
! #undef EUNICE /* no file linking? */
! #undef VMS
! #undef CHARSPRINTF /* sprintf does NOT return pointer to char */
! #undef FLEXFILENAMES /* file names must be 14 chars or less */
! #ifdef TURBOC20
! #define index strchr /* cultural */
! #define rindex strrchr /* differences? */
! #define VOIDSIG /* signal returns ptr to function returning void*/
! #define VOIDFLAGS 7 /* full void support */
! #endif
/* How many register declarations are paid attention to? */
#define Reg1 register
#define Reg2 register
#define Reg3 register
! #define Reg4
! #define Reg5
! #define Reg6
#define Reg7
#define Reg8
#define Reg9
*** ../patch/inp.c Thu May 24 14:21:46 1990
--- inp.c Thu May 31 10:37:49 1990
***************
*** 1,6 ****
! /* $Header: inp.c,v 2.0.1.1 88/06/03 15:06:13 lwall Locked $
*
* $Log: inp.c,v $
* Revision 2.0.1.1 88/06/03 15:06:13 lwall
* patch10: made a little smarter about sccs files
*
--- 1,12 ----
! /* $Header: inp.c,v 2.0.1.2 90/05/30 11:30:00 mward $
*
* $Log: inp.c,v $
+ * Revision 2.0.1.2 90/05/30 11:30:00 mward
+ * if TURBOC20 have plan_a check against MAXMEMBLK before mallocs
+ * if TURBOC20 have plan_b use binary mode io for tmp file
+ * modified plan_a to allow for translation shrinkage on text reads
+ * modify calls to read, write to detect error on return value of -1
+ *
* Revision 2.0.1.1 88/06/03 15:06:13 lwall
* patch10: made a little smarter about sccs files
*
***************
*** 120,128 ****
out_of_mem = FALSE;
return FALSE; /* force plan b because plan a bombed */
}
- #ifdef lint
i_womp = Nullch;
! #else
i_womp = malloc((MEM)(i_size+2)); /* lint says this may alloc less than */
/* i_size, but that's okay, I think. */
#endif
--- 126,136 ----
out_of_mem = FALSE;
return FALSE; /* force plan b because plan a bombed */
}
i_womp = Nullch;
! #ifndef lint
! #ifdef TURBOC20
! if (i_size < MAXMEMBLK)
! #endif
i_womp = malloc((MEM)(i_size+2)); /* lint says this may alloc less than */
/* i_size, but that's okay, I think. */
#endif
***************
*** 131,137 ****
if ((ifd = open(filename, 0)) < 0)
fatal2("Can't open file %s\n", filename);
#ifndef lint
! if (read(ifd, i_womp, (int)i_size) != i_size) {
Close(ifd); /* probably means i_size > 15 or 16 bits worth */
free(i_womp); /* at this point it doesn't matter if i_womp was */
return FALSE; /* undersized. */
--- 139,145 ----
if ((ifd = open(filename, 0)) < 0)
fatal2("Can't open file %s\n", filename);
#ifndef lint
! if ((i_size=(unsigned)read(ifd, i_womp, (int)i_size)) == (unsigned)-1) {
Close(ifd); /* probably means i_size > 15 or 16 bits worth */
free(i_womp); /* at this point it doesn't matter if i_womp was */
return FALSE; /* undersized. */
***************
*** 149,157 ****
if (*s == '\n')
iline++;
}
- #ifdef lint
i_ptr = Null(char**);
! #else
i_ptr = (char **)malloc((MEM)((iline + 2) * sizeof(char *)));
#endif
if (i_ptr == Null(char **)) { /* shucks, it was a near thing */
--- 157,167 ----
if (*s == '\n')
iline++;
}
i_ptr = Null(char**);
! #ifndef lint
! #ifdef TURBOC20
! if (iline+2<MAXMEMBLK/sizeof(char *))
! #endif
i_ptr = (char **)malloc((MEM)((iline + 2) * sizeof(char *)));
#endif
if (i_ptr == Null(char **)) { /* shucks, it was a near thing */
***************
*** 210,215 ****
--- 220,228 ----
fatal2("Can't open file %s\n", filename);
if ((tifd = creat(TMPINNAME, 0666)) < 0)
fatal2("Can't open file %s\n", TMPINNAME);
+ #ifdef TURBOC20
+ setmode(tifd, O_BINARY);
+ #endif
while (fgets(buf, sizeof buf, ifp) != Nullch) {
if (revision != Nullch && !found_revision && rev_in_string(buf))
found_revision = TRUE;
***************
*** 245,257 ****
fatal1("Can't seem to get enough memory.\n");
for (i=1; ; i++) {
if (! (i % lines_per_buf)) /* new block */
! if (write(tifd, tibuf[0], BUFFERSIZE) < BUFFERSIZE)
fatal1("patch: can't write temp file.\n");
if (fgets(tibuf[0] + maxlen * (i%lines_per_buf), maxlen + 1, ifp)
== Nullch) {
input_lines = i - 1;
if (i % lines_per_buf)
! if (write(tifd, tibuf[0], BUFFERSIZE) < BUFFERSIZE)
fatal1("patch: can't write temp file.\n");
break;
}
--- 258,270 ----
fatal1("Can't seem to get enough memory.\n");
for (i=1; ; i++) {
if (! (i % lines_per_buf)) /* new block */
! if (write(tifd, tibuf[0], BUFFERSIZE) == -1)
fatal1("patch: can't write temp file.\n");
if (fgets(tibuf[0] + maxlen * (i%lines_per_buf), maxlen + 1, ifp)
== Nullch) {
input_lines = i - 1;
if (i % lines_per_buf)
! if (write(tifd, tibuf[0], BUFFERSIZE) == -1)
fatal1("patch: can't write temp file.\n");
break;
}
***************
*** 258,264 ****
--- 271,281 ----
}
Fclose(ifp);
Close(tifd);
+ #ifdef TURBOC20
+ if ((tifd = open(TMPINNAME, O_BINARY)) < 0) {
+ #else
if ((tifd = open(TMPINNAME, 0)) < 0) {
+ #endif
fatal2("Can't reopen file %s\n", TMPINNAME);
}
}
***************
*** 287,293 ****
#ifndef lint /* complains of long accuracy */
Lseek(tifd, (long)baseline / lines_per_buf * BUFFERSIZE,